TARGET = 
PREFIX_LIB = /usr/lib
PREFIX_INCLUDE = /usr/local/include
INSTALL_HEADERS = 

CC = gcc

INCLUDES = include
LIBS = 
CFLAGS =-O3 -fPIC -Wall -Werror
LINKFLAGS = -shared

C_SOURCES = $(wildcard src/*.c)
C_OBJS = $(patsubst %.c, %.o, $(C_SOURCES))

.c.o:
	$(CC) -c $(CFLAGS) $(INCLUDES) $<

compile: $(C_OBJS)
	$(CC)  $(LINKFLAGS) -o $(TARGET) $^ $(LIBS)

clean:
	rm -f $(C_OBJS)
	rm -f $(TARGET)

install: $(TARGET)
	cp $(TARGET) $(PREFIX_LIB)
	cp $(INSTALL_HEADERS) $(PREFIX_INCLUDE)

uninstall:
	rm -f $(PREFIX_LIB)/$(TARGET)
	cd $(PREFIX_INCLUDE); rm -f $(INSTALL_HEADERS)

rebuild: clean compile 
